From: Keir Fraser Date: Thu, 18 Jun 2009 09:18:10 +0000 (+0100) Subject: xend: pci: find_parent: should return string rather than int X-Git-Tag: archive/raspbian/4.8.0-1+rpi1~1^2~13737 X-Git-Url: https://dgit.raspbian.org/%22http://www.example.com/cgi/%22/%22http:/www.example.com/cgi/%22?a=commitdiff_plain;h=b250b06ee400a98c5f5d46336bfe2acb9af790cd;p=xen.git xend: pci: find_parent: should return string rather than int Using changeset 19783: 61ec78692b13, device assignment can't work: e.g., in find_the_uppermost_pci_bridge(), parent = dev_parent.find_parent() ... dev_parent = PciDevice(parent), we can see parent['domain'] is int and in PciDevice's __init__, int(dev['domain'], 16) would fail: TypeError: int() can't convert non-string with explicit base Signed-off-by: Dexuan Cui --- diff --git a/tools/python/xen/util/pci.py b/tools/python/xen/util/pci.py index 260ad7f2a9..b990b91cbd 100644 --- a/tools/python/xen/util/pci.py +++ b/tools/python/xen/util/pci.py @@ -547,12 +547,12 @@ class PciDevice: else: dev = {} lst = parent.split(':') - dev['domain'] = int(lst[0], 16) - dev['bus'] = int(lst[1], 16) + dev['domain'] = '%04x' % int(lst[0], 16) + dev['bus'] = '%02x' % int(lst[1], 16) lst = lst[2] lst = lst.split('.') - dev['slot'] = int(lst[0], 16) - dev['func'] = int(lst[1], 16) + dev['slot'] = '%02x' % int(lst[0], 16) + dev['func'] = '%x' % int(lst[1], 16) return dev except OSError, (errno, strerr): raise PciDeviceParseError('Can not locate the parent of %s',